package org.example;

import java.util.ArrayList;
import java.util.List;

//所有观察者
public abstract class Subject {

    protected String allyName;
    protected List<Observer> players=new ArrayList<Observer>();
    public void addPlayers(Observer player){
        System.out.println("增加玩家:"+player.getName());
        this.players.add(player);
    }
    public void deletePlayers(Observer player){
        System.out.println("删除玩家:"+player.getName());
        this.players.remove(player);
    }

    public abstract void notifyObservers(String name);
}
